package com.example.human_resource_management.mapper;

import com.example.human_resource_management.entry.dto.ResourceDto;
import com.example.human_resource_management.entry.po.Resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【resource(资源表)】的数据库操作Mapper
* @createDate 2025-06-09 16:40:21
* @Entity com.example.human_resource_management.entry.po.Resource
*/
public interface ResourceMapper extends BaseMapper<Resource> {

    @Select("SELECT r.*, d.dept_name " +
            "FROM resource r " +
            "LEFT JOIN department d ON r.dept_id = d.dept_id " +
            "WHERE r.dept_id = #{deptId}")
    List<ResourceDto> selectResourcesByDeptId(Long deptId);





    @Select("SELECT r.res_id, r.res_name, r.res_type, r.description, d.dept_name  " +
            "FROM resource r " +
            "JOIN department d ON r.dept_id = d.dept_id")
    List<ResourceDto> selectAllResources();
}




